  package org.flhy.step.idcard.id15to18;

  import java.util.List;
  import org.pentaho.di.core.Const;
  import org.pentaho.di.core.annotations.Step;
  import org.pentaho.di.core.database.DatabaseMeta;
  import org.pentaho.di.core.exception.KettleException;
  import org.pentaho.di.core.exception.KettleStepException;
  import org.pentaho.di.core.exception.KettleXMLException;
  import org.pentaho.di.core.injection.Injection;
  import org.pentaho.di.core.injection.InjectionSupported;
  import org.pentaho.di.core.row.RowMetaInterface;
  import org.pentaho.di.core.row.ValueMetaInterface;
  import org.pentaho.di.core.row.value.ValueMetaString;
  import org.pentaho.di.core.variables.VariableSpace;
  import org.pentaho.di.core.xml.XMLHandler;
  import org.pentaho.di.i18n.BaseMessages;
  import org.pentaho.di.repository.ObjectId;
  import org.pentaho.di.repository.Repository;
  import org.pentaho.di.trans.Trans;
  import org.pentaho.di.trans.TransMeta;
  import org.pentaho.di.trans.step.BaseStepMeta;
  import org.pentaho.di.trans.step.StepDataInterface;
  import org.pentaho.di.trans.step.StepInterface;
  import org.pentaho.di.trans.step.StepMeta;
  import org.pentaho.di.trans.step.StepMetaInterface;
  import org.pentaho.metastore.api.IMetaStore;
  import org.w3c.dom.Node;

  @Step(id="idcard15to18", i18nPackageName="org.flhy.step.idcard.Id15to18", name="idcard15to18.name", image="ui/images/idcard15to18.svg", categoryDescription="i18n:org.pentaho.di.trans.step:BaseStep.Category.Transform")
  @InjectionSupported(localizationPrefix="GPLoad.Injection.", groups={"FIELDS", "LOCALHOSTS", "GP_CONFIG"})
  public class id15to18Meta
    extends BaseStepMeta implements StepMetaInterface
  {
      static{
          System.out.println("1111111111111111111111111111111111111111111111111111111111111111111");
      }
   private static Class<?> PKG = id15to18Meta.class;

    @Injection(name="FIELDNAME")
    private String fieldToUse;
    @Injection(name="RESULTFIELD")
    private String resultField;

    public String getFieldToUse()
    {
    return this.fieldToUse;
    }

    public void setFieldToUse(String fieldToUse) {
/*  48 */     this.fieldToUse = fieldToUse;
    }



    public String getResultField()
    {
  return this.resultField;
    }




    public void setResultField(String resultField)
    {
     this.resultField = resultField;
    }

    public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore) throws KettleXMLException
    {
   readData(stepnode);
    }

    private void readData(Node stepnode) throws KettleXMLException {
      try {
     this.fieldToUse = XMLHandler.getTagValue(stepnode, "field_to_use");
      this.resultField = XMLHandler.getTagValue(stepnode, "result_field");
      } catch (Exception e) {
      throw new KettleXMLException(BaseMessages.getString(PKG, "dddd", new String[0]), e);
      }
    }

    public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases) throws KettleException
    {
      try {
       this.fieldToUse = rep.getStepAttributeString(id_step, "field_to_use");this.resultField = rep.getStepAttributeString(id_step, "result_field");
      } catch (Exception e) {
      throw new KettleException(BaseMessages.getString(PKG, "dddd", new String[0]), e);
      }
    }



    public void setDefault() {}



    public StepInterface getStep(StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans)
    {
    return new id15to18(stepMeta, stepDataInterface, copyNr, transMeta, trans);
    }

    public StepDataInterface getStepData()
    {
   return new id15to18Data();
    }

    public String getXML() {
     StringBuffer retval = new StringBuffer();

    retval.append("    ").append(XMLHandler.addTagValue("field_to_use", this.fieldToUse));
    retval.append("    ").append(XMLHandler.addTagValue("result_field", this.resultField));

   return retval.toString();
    }

    public void saveRep(Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step) throws KettleException
    {
      try {
      rep.saveStepAttribute(id_transformation, id_step, "field_to_use", this.fieldToUse);
      rep.saveStepAttribute(id_transformation, id_step, "result_field", this.resultField);
      }
      catch (Exception e) {
       throw new KettleException(BaseMessages.getString(PKG, "GPLoadMeta.Exception.UnableToSaveStepInfoToRepository", new String[0]) + id_step, e);
      }
    }



    public String getDialogClassName()
    {
    return id15to18Dialog.class.getCanonicalName();
    }

    public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException
    {
   if (!Const.isEmpty(this.resultField)) {
      ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(this.resultField));
      v.setOrigin(name);
       inputRowMeta.addValueMeta(v);
      }
    }

      static{
          System.out.println("122222222222222222222222222222222222222222222222222222222222222111");
      }
  }
